﻿@model RolePowerDto
@Html.Extra()
@{
    Layout = "~/Views/Shared/OA/_Edit.cshtml";
}
@section Toolbar
{
    @Html.MyNet().Button(new ButtonOptions { Text = "保存", Click = "save" })
    @Html.MyNet().Button(new ButtonOptions { Text = "返回", Click = "back" })
}


@section Main
{
    @Html.HiddenFor(model => model.RoleId)
    <style>
        div.k-treeview {
            overflow: hidden;
        }
    </style>
    <table style="overflow:hidden">
        <tr>
            <th>
            </th>
            <td>

                @Html.MyNet().CheckBoxTreeFor(model => model.PowerKeys, Url.Action("Read", "Module", new { Application = Request["Application"] }), "key", InputValueType.Array
                        )
            </td>
        </tr>
    </table>
}
<style>
    .form th {
        width: 10px;
    }
</style>
<script>
    function test() {
        alert($("input[name='PowerKeys']:checked").length);
    }
    function save() {
        var form = $("form");
        if (!form.valid()) return;

        $.ajax
        ({
            url: form.attr("action"),
            data: form.serialize(),
            type: "post",
            error: disposeError,
            success: function (result) {
                if (disposeException(result)) return;
                back(true);
            }
        });
    }

</script>
